<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
    <script>
    (function(){
        //模仿requirejs的模块化
        var requireJsFn = function(){
            var keep = 0;       //因为闭包的作用，所以这个变量会一直保存
            return {
                initialize:function(){
                    keep = 3;
                },
                getKeep:function(){
                    setTimeout(function(){
                        alert(keep);           //变量还是为3，被保存起来了
                    },2600);
                }
            }
        }
        var requireJsObj = requireJsFn();
        requireJsObj.initialize();
        requireJsObj.getKeep();
    })();
    </script>
</html>